package com.gec.hawaste.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gec.hawaste.service.IWorkOrderService;
import com.gec.hawaste.utils.PageInfo;
import com.gec.hawaste.utils.ResultBean;
import com.gec.hawaste.vo.WorkOrderDo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author chenxys
 * @since 2022-07-01
 */
@Slf4j
@RestController
@RequestMapping("/manager/work")
public class WorkOrderController {
    @Autowired
    private IWorkOrderService workOrderService;

    /**
     * 电子账台分页查询
     * @author chenxys
     * @param pageNum 当前页
     * @param pageSize 每页显示条数
     * @param params 查询参数
     * @return com.gec.hawaste.utils.ResultBean<com.baomidou.mybatisplus.extension.plugins.pagination.Page>
     */
    @GetMapping("/select/{pageNum}/{pageSize}")
    public ResultBean<Page> select(@PathVariable("pageNum") Long pageNum,
                                   @PathVariable("pageSize") Long pageSize,
                                   @RequestParam Map<String,Object> params){
        PageInfo<WorkOrderDo> pageInfo = (PageInfo<WorkOrderDo>) workOrderService.selectByCondition(new PageInfo<WorkOrderDo>(pageNum,pageSize),params);
        pageInfo.setNavigatePage();
        log.info("分页查询电子台账");
        return ResultBean.ok(pageInfo);
    }
}
